package com.qhs.framework.utils;

import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
import org.springframework.core.io.support.PropertiesLoaderUtils;

import java.io.IOException;
import java.util.Properties;

/**
 * Created by zano on 2017/3/20.
 */
public class ConfigUtil {
    private static Resource resource = new ClassPathResource("system.properties");

    private static Properties props = null;

    public static String get(String key){
        if(props==null){
            try {
                props = PropertiesLoaderUtils.loadProperties(resource);
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return props.getProperty(key);
    }
}
